import { defineStore } from 'pinia'
import { ref } from "vue"
export const useUserStore = defineStore(
    'user',
    () => {
        let token = ref('')

        const setToken = (data) => {
            token.value = data
        }
        return {
            token,
            setToken
        }
    },
    // TODO: 持久化
    {
        // 网页端的配置
        // persist: true,
        // 小程序端的配置
        persist: {
            storage: {
                getItem: (key) => uni.getStorageSync(key),
                setItem: (key, value) => uni.setStorageSync(key, value)
            },
        },
    },
)